package com.timeriver.service.impl;

import com.timeriver.domain.entity.Menu;
import com.timeriver.domain.vo.MenusVO;
import com.timeriver.repository.MenuRepository;
import com.timeriver.service.AuthService;
import com.timeriver.utils.EntityConvertUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AuthServiceImpl implements AuthService {

    @Autowired
    private MenuRepository repository;

    @Override
    public List<MenusVO> getMenus() {
        List<Menu> all = repository.findAll();
        return EntityConvertUtil.objects2DtosOrEntitys(all, MenusVO.class);
    }
}
